package at.fhj.itm11.forum.service.converter;

import java.util.ArrayList;
import java.util.List;

import at.fhj.itm11.forum.model.Icon;
import at.fhj.itm11.forum.service.dtos.IconDTO;

public class IconDTOConverter implements DTOConverter<IconDTO, Icon> {

	@Override
	public IconDTO convertToDto(Icon entity) {
		IconDTO iconDto = new IconDTO();
		iconDto.setId(entity.getId());
		iconDto.setFileName(entity.getFileName());
		
		return iconDto;
	}

	@Override
	public List<IconDTO> convertToDto(List<Icon> entities) {
		List<IconDTO> iconDtoList = new ArrayList<IconDTO>();
		
		for(Icon iconEntity : entities) {
			iconDtoList.add(convertToDto(iconEntity));
		}
		
		return iconDtoList;
	}

	@Override
	@Deprecated
	public Icon convertToEntity(IconDTO dto) {
		Icon i = new Icon();
		i.setId(dto.getId());
		i.setFileName(dto.getFileName());
		
		return i;
	}

}
